<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../test/mdui/css/mdui.min.css">
</head>

<style>
    .fullScreen {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 10007;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, .7);
    }

    .SearchBar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 10009;
        background-color: transparent;
        transition: .3s
    }

    .outOfSearch {
        box-sizing: border-box;
        margin: 0 7px;
        padding: 5px 0 5px 9pt;
        width: 30%;
        height: 80%;
        border-radius: 3px;
        background-color: hsla(0, 0%, 100%, .3);
        transition: .7s
    }

    .seaicon {
        margin-top: 3px
    }

    .theme {
        background-color: #3f51b5 !important;
        color: #fff !important;
    }

    .seainput {
        display: inline-block;
        box-sizing: border-box;
        padding: 0 0 0 7px;
        width: 100%;
        height: 30px;
        outline: 0;
        border: 0;
        background: 0;
        color: #fff;
        font-size: 17px;
        resize: none;
        transition: .5s;
        -webkit-appearance: none;
        -moz-appearance: none;
    }

    .seainput::-webkit-input-placeholder {
        color: #fff;
        opacity: .5
    }

    .seainput:-ms-input-placeholder {
        color: #fff;
        opacity: .5
    }

    .titleBarGobal {
        position: fixed;
        height: 4pc;
        width: 100%;
    }

    .s-enter-active {
        transition: all .5s ease;
    }

    .s-leave-active {
        transition: all 1s ease;
    }

    .s-enter,
    .s-leave-to {
        opacity: 0;
    }
    .zoom-enter-active {
        transition: all .5s ease;
    }

    .zoom-leave-active {
        transition: all .5s ease;
    }

    .zoom-enter,
    .zoom-leave-to {
        transform: scale(0);
    }

    .OutOfsearchBox {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 10008;
        overflow-y: auto;
        width: 100%;
        height: 100%;
        pointer-events: none
    }

    .underline {
        margin-bottom: 8px
    }

    .searchBoxFill {
        width: 100%;
        height: 72px
    }

    .searchCard {
        box-sizing: border-box;
        margin: 0 auto 10px;
        padding: 15px 15px 8px;
        width: 90%;
        max-width: 650px;
        background-color: #fff;
        color: rgba(0, 0, 0, .87);
        pointer-events: auto;
        border-radius: 8px;
    }

    .searchCard h1 {
        margin-top: 5px;
        word-break: break-word
    }

    .searchCard a:before {
        display: none
    }
</style>

<body>
    <div id="root" class="topLand">
        <button @click="close" :class="{'hah':true}">11</button>
        <transition>
            <search-bg s-show="show" @close="close"></search-bg>
        </transition>
        <transition>
            <div s-if="show" class="SearchBar titleBarGobal mdui-appbar mdui-shadow-0 mdui-text-color-white-text theme">
                <form class="mdui-toolbar mdui-appbar-fixed">
                    <div ref="input" class="outOfSearch mdui-valign" style="width: 50%;">
                        <label>
                            <i class="mdui-icon material-icons seaicon"></i>
                        </label>
                        <input class="seainput" s-model:value="msg" type="text" placeholder="搜索点什么...">
                    </div>
                    <div class="mdui-toolbar-spacer"></div>
                    <span @click="close" class="mdui-btn mdui-btn-icon sea-close">
                        <i class="mdui-icon material-icons"></i>
                    </span>
                </form>
            </div>
        </transition>
        <search-res haha s-show="show" :count="count"></search-res>
    </div>
</body>
<script type="module">
    import Sact from "../src/sact.js";
    let www = Sact.component({
        name: "search-bg",
        template: `
            <div @click="close" class="fullScreen"></div>
        `,
        props: ["close"],
        method: {
            close() {
                this.props.close && this.props.close();
            }
        }
    })
    let input = Sact.component({
        name:"search-input",
        template:`
        <div class="SearchBar titleBarGobal mdui-appbar mdui-shadow-0 mdui-text-color-white-text theme">
            <form class="mdui-toolbar mdui-appbar-fixed">
                <div class="outOfSearch mdui-valign">
                    <label>
                        <i class="mdui-icon material-icons seaicon"></i>
                    </label>
                    <input class="seainput" @input="props.getInput" type="text" placeholder="搜索点什么...">
                </div>
            </form>
        </div>
        `,
        props:["getInput"]
    })
    let pp = Sact.component({
        name: "search-res",
        template: `
        <div class="OutOfsearchBox">
            <div class="searchBoxFill"></div>
            <transition name="zoom" :key="w" s-for="w in props.count">
            <article class="searchCard mdui-shadow-2 mdui-typo">
                <a>
                    <h1>2020年度总结</h1>
                </a>
                <p>2020 即将过去，2021 已在眼前。2020 实在是多灾多难的一年，新冠疫情可以说是严重打乱了我的生活计划…
                </p>
                <div class="mdui-divider underline"></div>
                <span class="info">
                    <i class="mdui-icon material-icons info-icon"></i>
                    2020-12-30
                </span>
            </article>
            </transition>
        </div>
        `,
        props: {
            "count": {
                type: "number",
                default: 2,
            },
            "haha":["string"],
        },
        propsTransfrom:true,
        mounted(){
            console.log(this.props)
        }
    })
    window.qq = new Sact({
        el: "#root",
        data: {
            show: true,
            msg: "123",
        },
        method: {
            close() {
                this.data.show = !this.data.show;
            }
        },
        mounted(){
            setTimeout(()=>{
                this.$refs.input.style.width = "75%";
            },0)
        },
        computed: {
            count() {
                return this.data.msg.length
            }
        },
        component: {
            www, pp
        }
    })
</script>

</html>